package com.sky.mapper;

import com.sky.entity.Dish;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetMealDishMapper {
    //根据菜品id查询对应的套餐id
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    //新增套餐时为套餐菜品关系表添加数据
    void insertBatch(List<SetmealDish> setmealDishList);


    //根据套餐表中的主键id查询套餐信息
    @Select("select * from setmeal where id=#{id}")
    Setmeal chaxunById(Long id);


    //删除套餐关联的菜品
    @Delete("delete from setmeal_dish where setmeal_id=#{id} ")
    void deleteBySetmealId(Long id);
    // 根据套餐id查询关联菜品
    @Select("select * from setmeal_dish where setmeal_id=#{id}")
    List<SetmealDish> chaxuncaipinById(Long id);

}
